(function(){"use strict";BX.namespace("BX.Landing.UI");const e=BX.Landing.Utils.slice;BX.Landing.UI.Style=function(e){this.node="node"in e?e.node:null;this.id="id"in e?e.id:null;this.selector="selector"in e?e.selector:null;this.relativeSelector="relativeSelector"?e.relativeSelector:null;this.clickHandler="onClick"in e?e.onClick:function(){};this.iframe="iframe"in e?e.iframe:null;this.affects=new BX.Landing.Collection.BaseCollection;this.inlineProperties=[];this.computedProperties=[];this.pseudoElement=null;this.isSelectGroupFlag=null;this.onFrameLoad()};BX.Landing.UI.Style.SERVICE_CLASSES=["landing-card","slick-slide","slick-current","slick-active"];BX.Landing.UI.Style.prototype={onFrameLoad:function(){if(this.node){this.node=BX.type.isArray(this.node)?this.node:[this.node]}else{this.node=this.getNode(true)}this.currentTarget=this.node[0];this.node.forEach((function(e){e.addEventListener("click",this.onClick.bind(this));e.addEventListener("mouseover",this.onMouseEnter.bind(this));e.addEventListener("mouseleave",this.onMouseLeave.bind(this))}),this);this.value=this.getValue()},getNode:function(t){const i=e(this.iframe.document.querySelectorAll(this.relativeSelector));if(this.isSelectGroup()||t){return i}return this.currentTarget?[i[this.getElementIndex(this.currentTarget)]]:[]},getTargetElement:function(){return this.currentTarget},getElementIndex:function(e){return[].indexOf.call(this.getNode(true),e)},onClick:function(e){if(BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){e.preventDefault();e.stopPropagation();this.currentTarget=e.currentTarget;this.clickHandler()}},onMouseEnter:function(e){e.preventDefault();e.stopPropagation();this.highlight(e.currentTarget)},onMouseLeave:function(e){e.preventDefault();e.stopPropagation();this.unHighlight();var t=BX.type.isArray(this.node)&&this.node.length?this.node[0]:this.node;BX.fireEvent(t.parentNode,"mouseenter")},isSelectGroup:function(){if(this.isSelectGroupFlag!==null){return this.isSelectGroupFlag}return window.localStorage.getItem("selectGroup")==="true"},setIsSelectGroup:function(e){this.isSelectGroupFlag=!!e},unsetIsSelectGroupFlag:function(){this.isSelectGroupFlag=null},highlight:function(e){if(BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){if(this.isSelectGroup()){e=this.node}BX.Landing.UI.Highlight.getInstance().show(e)}},unHighlight:function(){BX.Landing.UI.Highlight.getInstance().hide()},isChanged:function(){const e=this.getValue();if(JSON.stringify(this.value)!==JSON.stringify(e)){return true}else{return this.lastValue!==undefined&&JSON.stringify(this.lastValue)!==JSON.stringify(e)}},setInlineProperty:function(e){if(!BX.Type.isArray(e)){e=[e]}e.forEach((function(e){if(this.inlineProperties.indexOf(e)===-1){this.inlineProperties.push(e)}}),this);this.value=this.getValue()},setComputedProperty:function(e){if(!BX.Type.isArray(e)){e=[e]}e.forEach((function(e){if(this.computedProperties.indexOf(e)===-1){this.computedProperties.push(e)}}),this);this.value=this.getValue()},setPseudoElement:function(e){this.pseudoElement=e;this.value=this.getValue()},setValue:function(t,i,n,s,l){this.lastValue=this.currentValue;this.currentValue=this.getValue();if(!t){return}s=!!s?s:"";if(s.length){this.setAffects(s)}if(BX.type.isObjectLike(t)){if("from"in t&&"to"in t){t.from+="-min";t.to+="-max"}if(!("style"in t)){var r=Object.keys(t);t=r.map((function(e){return t[e]}))}}else{t=[t]}this.getNode().forEach((function(n){if(BX.type.isArray(t)){this.setValueClass(n,t,i,s)}if(BX.type.isObjectLike(t)){if("style"in t){this.setValueStyle(n,t.style)}if("className"in t&&BX.type.isArray(t.className)){this.setValueClass(n,t.className,i,s)}}if(s){if(s!=="background-image"){e(n.querySelectorAll("*")).forEach((function(e){e.style[s]=null;if(s==="color"){e.removeAttribute("color")}}))}}if(l){l.items.forEach((function(e){n.classList.remove(e.value)}))}}),this)},setAffects(e){e=BX.Type.isArray(e)?e:[e];e.forEach((e=>{if(e!=="background-image"){this.affects.add(e)}}))},setValueClass:function(e,t,i,n){if(BX.type.isArray(i)){e.style[n]=null;t.forEach((function(n){i.forEach((function(i){if(t.indexOf(i.value)===-1&&t.indexOf(i.value+"-min")===-1&&t.indexOf(i.value+"-max")===-1){e.classList.remove(i.value);e.classList.remove(i.value+"-min");e.classList.remove(i.value+"-max")}}));e.classList.add(n)}))}},setValueStyle:function(e,t){this.inlineProperties.forEach((function(i){if(i in t){e.style.setProperty(i,t[i])}}))},getValue:function(t){const i=this.getNode().length?this.getNode()[0]:null;const n={};if(i){let e=false;if(this.inlineProperties.length){e=true;const t=i.style;this.inlineProperties.forEach((i=>{n[i]=t.getPropertyValue(i).trim()||null;if(i==="background-image"&&!!n[i]){n[i]=n[i].replaceAll('"',"'")}e=e&&!!n[i]}))}if(!!t&&this.computedProperties.length&&!e){this.computedProperties.forEach((e=>{n[e]=getComputedStyle(i,this.pseudoElement).getPropertyValue(e)||null}))}}return{classList:i?this.sanitizeClassList(e(i.classList)):[],affect:this.affects.toArray(),style:n}},sanitizeClassList:function(e){const t=[];e.forEach((e=>{if(BX.Landing.UI.Style.SERVICE_CLASSES.indexOf(e)===-1){t.push(e)}}));return t},sanitizeClassName:function(e){return this.sanitizeClassList(e.split(" ")).join(" ")}}})();
//# sourceMappingURL=style_node.map.js